var mongoose = require('mongoose');
var articleSchema = new mongoose.Schema({
    title: String,//文章标题
    type: {
        type: mongoose.Schema.Types.ObjectId,//关联类型集合
        ref: 'types'
    },//文章类型
    author: {
        type: mongoose.Schema.Types.ObjectId,//关联用户集合
        ref: 'users'
    },//作者
    read: {
        type: Number,
        default: 0
    },//被阅读数量
    content: String,//文章内容
    beCollected: [{
        type: mongoose.Schema.Types.ObjectId,//关联用户集合
        ref: 'users'
    }],
    time: {
        type: Number,
        default: new Date().getTime()
    },//创建文章时时间
    discuss: [
        {
            time: Number,
            msg: String,
            name: {
                type: mongoose.Schema.Types.ObjectId,//关联用户集合
                ref: 'users'
            }
        }
    ],//评论
    del: {
        type: Boolean,
        type: false
    }//是否已经删除
});

module.exports = articleSchema